package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.BitExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.IdentifierNotContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.PrecedenceEqualNegatableOperatorContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.ExpressionLikeContext;

public class ExpressionLikeVisitor extends AbsCQLParserBaseVisitor<ExpressionLikeContext> {

	private ExpressionLikeContext context = null;

	public ExpressionLikeVisitor() {
		context = new ExpressionLikeContext();
	}

	@Override
	protected ExpressionLikeContext defaultResult() {
		return context;
	}

	@Override
	public ExpressionLikeContext visitIdentifierNot(@NotNull IdentifierNotContext ctx) {
		context.setNotLike(true);
		return context;
	}

	@Override
	public ExpressionLikeContext visitPrecedenceEqualNegatableOperator(
			@NotNull PrecedenceEqualNegatableOperatorContext ctx) {
		context.setLikeOperator(ctx.getText());
		return context;
	}

	@Override
	public ExpressionLikeContext visitBitExpression(BitExpressionContext ctx) {
		BitExpressionVisitor visitor = new BitExpressionVisitor();
		context.setLikeExpression(visitor.visit(ctx));
		return context;
	}
}
